package org.jeecg.crawler.task;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.SneakyThrows;
import org.jeecg.common.util.DateTimeUtil;
import org.jeecg.modules.crawlerpaper.entity.CrawlerInfo;
import org.jeecg.modules.crawlerpaper.service.ICrawlerInfoService;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class DeleteScheduleTask {
    @Autowired
    private ICrawlerInfoService crawlerInfoService;




    @SneakyThrows
    @Scheduled(cron = "0 25 12 * * ?")
    public void nanjingchenbao() throws JobExecutionException {
        QueryWrapper<CrawlerInfo> queryWrapper = new QueryWrapper<>();
        String  lastTime = DateTimeUtil.getLastMonthChar10();
        queryWrapper.le("article_time",lastTime);
        crawlerInfoService.remove(queryWrapper);


    }

}
